﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;

namespace BeatEmUp.Menu
{
    public class MenuIntroScreen: MenuScreen
    {
        private GameManager game;
        KeyboardState oldState;
        private int r = 0, g = 0, b = 0;
        Texture2D introScreenImageTexture;
        Rectangle introScreenImageRectangle;
        Color bgMaskColor;

        public MenuIntroScreen(GameManager game) :
            base(game)
        {
            isTitleVisible = false;
            this.game = game;
            //introScreenImageRectangle = new Rectangle(game.graphics.PreferredBackBufferWidth / 2 - 140, game.graphics.PreferredBackBufferHeight / 2 - 80, 280, 160);
            introScreenImageRectangle = new Rectangle(game.graphics.PreferredBackBufferWidth / 2 - 492/2, game.graphics.PreferredBackBufferHeight / 2 - 81/2,492, 81);
        }


        public void LoadContent(ContentManager content)
        {
            LoadBaseContent(content);
            introScreenImageTexture = content.Load<Texture2D>("MenuGraphics/gameTitle");
        }

        public void Draw(SpriteBatch sb)
        {
            DrawBaseElements(sb);
            sb.Draw(introScreenImageTexture, introScreenImageRectangle, new Color(r,g,b));
        }

        public void Update(Microsoft.Xna.Framework.GameTime gameTime,MenuMainComponent menu)
        {
            KeyboardState newState = Keyboard.GetState();
            MouseState newMouseState = Mouse.GetState();

            if ((r < 255) || (g < 255) || (b < 255))
            {
                r++;
                g++;
                b++;
            }

            if ((newState.IsKeyDown(Keys.Space)) && (!oldState.IsKeyDown(Keys.Space)))
            {
                this.isVisibleAndActive = false;
                menu.mainScreen.isVisibleAndActive = true;
                bgMaskColor = Color.White;
            }
        }

    }
}
